import urllib
import re
import json

print "we will try to open this url, in order to get IP Address"

#Could config stream's code-format, return JSON format string 
url = "http://pv.sohu.com/cityjson?ie=utf-8"

http_return = urllib.urlopen(url).read()

#Get json information. the second item in string-array
#split charactor is '='
#thus index is '1'
json_str = http_return.split('=')[1]
json_str = json_str.split(';')[0]

print "original information: ", json_str

#return Python Dictionary type data
dict_ip = json.loads(json_str)
print "your IP Address is: ", dict_ip['cip']
print "your City is: ", dict_ip['cname']